home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Version 1.2
- Copyright (c) 1995 by Sean Luke
- Donated to the MiscKit
-
- Permission to use, copy, modify, and distribute this material
- for any purpose and without fee, under the restrictions as noted
- in the MiscKit copyright notice, is hereby granted, provided that
- the MiscKit copyright notice and this permission notice
- appear in all source copies, and that the author's name shall not
- be used in advertising or publicity pertaining to this
- material without the specific, prior written permission
- of the author. SEAN O. LUKE MAKES NO REPRESENTATIONS ABOUT THE
- ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.
- IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
-
- */
-
- #import "MiscSoundViewInspector.h"
- #import "MiscSoundUtil.subproj/MiscSoundView.h"
-
- @implementation MiscSoundViewInspector
-
- - init
- {
- char buf[MAXPATHLEN+1];
- id bundle;
-
- [super init];
- bundle=[NXBundle bundleForClass:[MiscSoundView class]];
- [bundle getPath:buf forResource:"MiscSoundViewInspector" ofType:"nib"];
- [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
- return self;
- }
-
-
- - ok:sender
- {
- float mi=[minor floatValue];
- int ma=[major intValue];
- int rul;
- int lab;
- int y;
- int z;
- int unit;
- int line;
- int scro;
-
- if ([lines selectedRow])
- {if ([lines selectedCol])
- line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_DECIBEL;
- else line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTY;}
- else
- {if ([lines selectedCol])
- line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTYFOUR;
- else line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_SIXTEEN;}
-
- scro=[scroll intValue];
- rul=[[display cellAt:0:0] intValue];
- lab=[[display cellAt:1:0] intValue];
- y=[[display cellAt:0:1] intValue];
- z=[[display cellAt:1:1] intValue];
-
- if ([units selectedRow]==0)
- unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SAMPLES;
- else if ([units selectedRow]==1)
- unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SECONDS;
- else unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_PERCENT;
-
- if (mi<=0.0){mi=1000.0;[minor setFloatValue:mi];}
- if (ma<=0){ma=10;[major setIntValue:ma];}
-
- [object set:rul:y:lab:z:ma:mi:unit:line:scro];
-
- return [super ok:sender];
- }
-
- - revert:sender
- {
- int line=[object yDisplayFormat];
- int unit=[object minorTickSpacingFormat];
-
- [scroll setIntValue:[object scrollToReflectPlaying]];
- [major setIntValue:[object majorTickSpacing]];
- [minor setFloatValue:[object minorTickSpacing]];
- [[display cellAt:0:0] setIntValue:[object xAxisDisplayed]];
- [[display cellAt:1:0] setIntValue:[object labelsDisplayed]];
- [[display cellAt:0:1] setIntValue:[object yAxisDisplayed]];
- [[display cellAt:1:1] setIntValue:[object zeroLineDisplayed]];
-
- if (unit==MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SAMPLES)
- [units selectCellAt:0:0];
- else if (unit==MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SECONDS)
- [units selectCellAt:1:0];
- else [units selectCellAt:2:0];
-
- if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_SIXTEEN)
- [lines selectCellAt:0:0];
- else if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTY)
- [lines selectCellAt:1:0];
- else if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTYFOUR)
- [lines selectCellAt:0:1];
- else [lines selectCellAt:1:1];
-
- return [super revert:sender];
- }
-
- - (BOOL) wantsButtons
- {
- return NO;
- }
-
- @end
-